#ifndef __ILIB_CORE_ALLOCATOR_H_20120319__
#define __ILIB_CORE_ALLOCATOR_H_20120319__

class iAllocator
{
public:
    class Object
    {
    public:
        inline Object(iAllocator* alloc) : m_allocator(alloc){}
        virtual ~Object(){}

    protected:
        iAllocator* m_allocator;
    };

	inline unsigned char* allocate(unsigned int size)
	{
		return new unsigned char[size];
	}

	inline void deallocate(void* ptr)
	{
		delete [](unsigned char*)ptr;
	}

    inline void deallocate(Object* ptr)
    {
        ptr->~Object();
        deallocate((void*)ptr);
    }
};

#endif  //__ILIB_CORE_ALLOCATOR_H_20120319__
